package gsb.android;

import android.widget.ArrayAdapter;
import DAO.DAO;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import java.util.List;

public class MainActivity extends ListActivity {

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        List<String> lesDeps = DAO.getLesDeps();
        ArrayAdapter<String> Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lesDeps);
        setListAdapter(Adapter);
//        List<String> lesMeds = DAO.getLesMeds(lesDeps);
//        ArrayAdapter<String> Adapterun = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_2, lesMeds);
//        setListAdapter(Adapterun);
    
    }
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id){
        Intent inter = new Intent(this, OtherActivity.class);
        inter.putExtra("leDep", l.getItemAtPosition(position).toString());
        startActivity(inter);
        
    }
}
